<script setup lang="ts">
import { onMounted, ref } from 'vue'
import Top from '@/views/screen/top/index.vue'
import Bottom from '@/views/screen/bottom/index.vue'

const screenRef = ref<any>()

const getScale = (w = 1920, h = 1080) => {
  const ww = window.innerWidth / w
  const wh = window.innerHeight / h
  return ww < wh ? ww : wh
}

onMounted(() => {
  screenRef.value.style.transform = `scale(${getScale()}) translate(-50%, -50%)`

  window.onresize = () => {
    screenRef.value.style.transform = `scale(${getScale()}) translate(-50%, -50%)`
  }
})
</script>

<template>
  <div class="container">
    <div class="screen" ref="screenRef">
      <Top />
      <Bottom />
    </div>
  </div>
</template>

<style scoped lang="scss">
.container {
  width: 100vw;
  height: 100vh;
  background: url('@/assets/images/data_screen/bg.jpg');
  background-size: cover;

  .screen {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 1920px;
    height: 1080px;
    transform: translate(-50%, -50%);

    //background: #00bbff;
    transform-origin: left top;
  }
}
</style>
